using System;
using HCP.Responses;
using HCP.SimpleJSON;
using UnityEngine;
using UnityEngine.EventSystems;

namespace HCP.Requests
{
	public class TouchMoveElement : JobRequest
	{
		public TouchMoveElement(JSONClass json) : base(json)
		{
		}

		public string Id
		{
			get
			{
				return base.Data["elementId"];
			}
		}

		public float X
		{
			get
			{
				return base.Data["x"].AsFloat;
			}
		}

		public float Y
		{
			get
			{
				return base.Data["y"].AsFloat;
			}
		}

		public override JobResponse Process()
		{
			Component elementById = JobRequest.GetElementById(this.Id);
			PointerEventData pointerEventData = new PointerEventData(EventSystem.current);
			pointerEventData.position = new Vector2(this.X, this.Y);
			ExecuteEvents.Execute<IMoveHandler>(elementById.gameObject, pointerEventData, ExecuteEvents.moveHandler);
			return new StringResponse();
		}
	}
}
